<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "f839bb8e-29fc-4185-b27d-e4c780e8341a"}); </script>
<link rel="stylesheet" href="/styles/thickbox.css" />
<script type="text/javascript" src="/scripts/thickbox.js"></script>
<div id="blockContIn">
<table border="0" cellspacing="0" cellpadding="0" align="left">
  <tr>
    <td valign="top"><div class="Col">
<div class="ModuleBlock">
<h1>
<label>Activity</label>

</h1>
<ul class="ModuleMenu">
<li><a href="#" class="active">My Activity</a> </li>

</ul>
<input type="text" value="Share Something"  class="share"/>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>
</div>
</div>
<div class="blkCont">
<img src="/images/ExpIcon.png" alt="Expression" title="Expression"/></div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/TrigIcon.png" alt="Expression" title="Expression"/>
</div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/ExpIcon.png" alt="Expression" width="14" height="14" title="Expression"/></div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/TrigIcon.png" alt="Expression" title="Expression"/>
</div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/TrigIcon.png" alt="Expression" title="Expression"/>
</div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>
<p><img src="/images/VideoImg.jpg"/></p>

</div>
</div>
<div class="blkCont">
<img src="/images/VideoIcon.png" alt="Expression" width="14" height="14" title="Expression"/></div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/TrigIcon.png" alt="Expression" title="Expression"/>
</div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/TrigIcon.png" alt="Expression" title="Expression"/>
</div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>


</div>
</div>
<div class="blkCont">
<img src="/images/VideoIcon.png" alt="Expression" title="Expression"/></div>
<div class="clear"></div>
</div>
<div class="activity">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
<p class="Date"> 5 Apr 2012</p>
</div>
<div class="blkCont">
<div class="wid150">
<p class="Title"><a href="#">Lorem ipsum dolor sit amet, curdolor dolor ...</a></p>
</div>
</div>
<div class="blkCont">
<img src="/images/PhotoIcon.png" alt="Expression" width="14" height="10" title="Expression"/></div>
<div class="clear"></div>
</div>
<div class="paginat">
<ul>
<li><a href="#"></a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">>></a></li>
</ul>
</div>
<div class="clear"></div>
</div>
</div></td>
	<td valign="top" width="100%"><div class="ColTrg">
<div class="ModuleBlock" style="height:1200px">
<h1>
<label>Tock</label>
<div><a href="/triggers/settings/triggers-settings"  ><img src="/images/SettingsIcon.png" border="0" alt="Settings" title="Settings" align="top" class="SetIcon"/></a>
<a id="create" href="javascript:void(0);" onclick="createTrigger();"><img src="/images/CreateAddIcon.png" alt="Create" width="15" height="15"  border="0"  align="top" class="SetIcon" title="Create"/></a>
</div>

</h1>
<div class="clear"></div>
<ul class="ModuleMenu">
<?php if($ctx->type == 1) { ?>
<li><a href="/triggers/index/triggers-personal" class="active">Personal</a> </li>
<?php } else {?> 
<li><a href="/triggers/index/shared" class="active">Shared</a> </li>
<?php }?>
</ul>
<div class="clear hig20"></div>
<div class="ListWid">
<div>
				<?php if(is_array($ctx->getTriggers['result']) && count($ctx->getTriggers['result'])>0) 
						{ 
							if($ctx->type == 2) { ?>
						<tal:block tal:content="structure php: this.partial('/index/shared-list.html')"/>
						<? } else { ?>
						<tal:block tal:content="structure php: this.partial('/index/personal-list.html')"/>
						<? }  ?>
				<? } else { ?>
				
					<strong>you don't have shared Tocks </strong>
				
				<? } ?>

</div>
</div>
<div class="Fleft wid55per" >
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td>
	<?php $count = count($ctx->triggerview['TriggersRelations']);
		if($count>1)
		{   
			if(@$ctx->triggerview['TriggersRelations'][0]['Groups'][0]['group_id'] != 0)
			{
				$profPic = '/Uploads/users/'.$ctx->triggerview['photo'];
				$otherCount = ($count-1);
				foreach($ctx->triggerview['TriggersRelations'] as $group)
				{
					$names[]= $group['Groups'][0]['name'];
				}
				//$others =  'and '.$otherCount.' other group(s)';
				$name = array_unique($names);
				$name = implode(',',$name);
				$name=$name.' groups';
				//echo '<pre>';print_r($name);exit;
				//$count = 0;
			} 
			else
			{
				$name = "public";
			}
		}
		else
			{
				$name = $ctx->triggerview['first_name'];
				
			}
			if(isset($ctx->triggerview['TriggersRelations'][0]['MyFavorites']['status']))
			{
			$favorite_status = $ctx->triggerview['TriggersRelations'][0]['MyFavorites']['status'];
			}
			else {
		$favorite_status = '';
		}
			
	?>
	<div class="BotBorder">
	<div class="Fleft">
	<p class="UName"><strong><?php echo $name;?></strong></p>
	</div>
	<div class="Fright">
	<table border="0" align="right" cellpadding="0" cellspacing="0">
	  <tr>
		<td><?php if($favorite_status=="Active"){?>
<p><a href="javascript:void(0);" onclick="changeStatusFavorite(<?php echo $ctx->triggerview['id'];?>,'Inactive')"><img src="/images/favoriteIcon.png" alt="Favorite" title="Favorite" /></a></p>
<? } else {?>
<p><a href="javascript:void(0);" onclick="changeStatusFavorite(<?php echo $ctx->triggerview['id'];?>,'Active')"><img src="/images/DefavoriteIcon.png" alt="Favorite" title="Favorite" /></a></p>
<? } ?></td>
		<td>&nbsp;</td>
		<td><!-- AddThis Button BEGIN -->
	<div class="addthis_toolbox addthis_default_style ">
		<a class="addthis_counter addthis_pill_style"></a>
	</div>
	<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
	<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fd0a4e94b4d16a7"></script>
	<!-- AddThis Button END --></td>
	  </tr>
	</table>	
</div>
<div class="clear"></div>
	</div>
	
	<div class="pad_t15">
	<p><?php echo $ctx->triggerview['message'];?></p>
	<?php if($ctx->type!=1) { ?>
	<div class="pad_t15">	
	
	<br />
	<p class="pad_b15"><a href="#" class="UserComment">Comments(<?php echo count($ctx->getComments['result']);?>)</a></p>
<div class="TrgComInput" style="background:#c4ebff;">
<div class="blkCont">
<p class="UserImg"><img src="/images/ListUserImg.jpg" /></p>
</div>

<div class="blkCont">
<div class="wid278">
<input type="text"  name="comment" id="comment" value="" class="TextFile" />
<div class="pad_t5"><a class="Button" href="javascript:void(0);" onclick="shareComment(<?php echo $ctx->trigger_id;?>);"><span>Share Comment</span></a></div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="listContent">
				<?php if(is_array($ctx->getComments['result']) && count($ctx->getComments['result'])>0) { ?>
				
					<tal:block tal:content="structure php: this.partial('/index/comment-list.html')"/>
				
				<? } else { ?>
				
					<strong>you don't have comments </strong>
				
				<? } ?>
</div>
<div class="clear"></div>
<div id="downPagerId" class="paginat" style="padding-right:15px;"></div>
</div>
<? } ?>
	</div>
	</td>
  </tr>
</table>
</div>
<div class="clear"></div>

</div>
</div></td>
<td valign="top">
<div class="ColBanner">
<div class="ModuleBlock">
<img src="/images/Gads.gif" /><img src="/images/Gads.gif" /></div>
</div></td>	
  </tr>
</table>
<div class="clear"></div>
</div>
<script type="text/javascript">
//<![CDATA[
pagination = new Array();
	pagination['currentPage'] = "<?=$ctx->getComments['currentPage']?>";
	pagination['resultsPerPage'] = "<?=$ctx->getComments['resultPerPage']?>";
	pagination['pages'] = "<?= $ctx->getComments['pages']?>";  
	pagination['pager'] = '<?=$ctx->getComments["pager"]?>';
	pagination['resultsCount'] = "${getComments/resultsCount}" ;
	
	var Params='${params}';
	//alert(pagination['resultsCount']+'  '+Params);
	var requestUrl = "/triggers/index/pagination/<?php echo base64_encode($ctx->trigger_id); ?>/";
	$(document).ready(function () {
	   setPagination(pagination['resultsCount'],'','downPagerId','','');
	});
function shareComment(val)
{
     //alert(val);return false;
	 var comment=$("#comment").val();
	 if(comment == "")
	 {
		alert("${php: this.translate('errmsg_comment')}");return false;
	 }
	 //alert(comment);return false;
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
				data: "val="+val+"&comment="+comment,
				url: "/triggers/index/share-comment",
			    success: function(data){
				location.reload();					
				}
			});
}
function deleteComment(comment_id)
{
     //alert(comment_id);return false;
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
				data: "comment_id="+comment_id,
				url: "/triggers/index/delete-comment",
			    success: function(data){
				location.reload();					
				}
			});
}
function createTrigger()
{
	tb_show('Create Tock','/triggers/index/create?&height=400&width=600','');
}
function deleteTrigger(id,action)
{
	//alert(id+"and"+action);return false;
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
			    data: "val="+id+"&action="+action,
			    url: "/triggers/index/deleteshared-trigger/",
			    success: function(data){
					location.reload();					
				}
			});
}
function changeStatustoClose(val)
{
	//alert("close");return false;
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
			    data: "val="+val,
			    url: "/triggers/index/delete-trigger/",
			    success: function(data){
					location.reload();					
				}
			});
}
function changeStatusFavorite(trigger_id,status)
{
	//alert(trigger_id+"and"+status);return false;
	$.ajax({
			   
			    type: "POST",
				dataType: "json",
			    data: "trigger_id="+trigger_id+"&status="+status+"&type=triggers",
			    url: "/triggers/index/favorite/",
			    success: function(data){
					location.reload();					
				}
			});
}
function shareTrigger(id)
{
	//alert(message);return false;
	tb_show('Share Tock',"/triggers/index/create?&trigger_id='"+id+"'&height=400&width=600",'');
}
//]]>
</script>
